Remove empty values node after predicate-expression based pruning#16019
Merged
phd3 merged 1 commit intotrinodb:masterfrom Mar 6, 2023
Merged
Remove empty values node after predicate-expression based pruning#16019phd3 merged 1 commit intotrinodb:masterfrom
phd3 merged 1 commit intotrinodb:masterfrom
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Pratham Desai.
|
cae105d to
4d9930a
Compare
b-slim
reviewed
Feb 7, 2023
martint
reviewed
Feb 21, 2023
| * The difference between this optimizer and {@link PushPredicateIntoTableScan} rule is that we | ||
| * invoke {@link PushPredicateIntoTableScan#pushFilterIntoTableScan} here with pruneWithPredicateExpression=true. | ||
| */ | ||
| public class PushFilterIntoTableScanWithPredicatePruning |
Member
There was a problem hiding this comment.
We shouldn't have to have a separate optimizer for this. It can be done by parameterizing the PushPredicateIntoTableScan to optionally prune with predicate expression.
Also, it should be implemented as a Rule, not as a PlanOptimizer -- we're trying to deprecate visitor based optimizers in favor of rules wherever possible.
Member
Author
There was a problem hiding this comment.
@martint added another invocation of PushPredicateIntoTableScan iterative optimizer
4d9930a to
a376384
Compare
a376384 to
373241c
Compare
373241c to
35c94cb
Compare
martint
approved these changes
Mar 3, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PushPredicateIntoTableScanrule invokespushFilterIntoTableScanwithpruneWithPredicateExpression=false. AddExchanges invokes this with pushFilterIntoTableScan=true, seems like the reason being that we've more control over the # of times such a potentially expensive optimization is invoked through a visitor based optimizer.Because of this - there can be cases where predicate-expression based pruning only happens during AddExchanges - leaving us with empty values node at this stage. And if that ends up on the left side of a replicated join - we end up in a situation where a single task is doing a join with LHS being local empty values node and RHS being a remote scan.
This PR adds an invocation of
pushFilterIntoTableScanwithpruneWithPredicateExpression=truebefore AddExchanges happens, giving us an opportunity to prune the empty values node - yielding a much more efficient plan.For the test added in this PR:
With the optimization:
Without the optimization: (with broadcast join enabled and forceSingleNode=false)
Additional context and related issues
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: